// KLASA: var4x4

#include <math.h>
#include "core/var4x4.h"

// Konstruktor
template<class T>
inline var4x4<T>::var4x4(void)
{
 identitize();
}

template<class T>
inline void var4x4<T>::identitize(void)
{
 this->m[1] = this->m[2] = this->m[3] = T(0);
 this->m[4] = this->m[6] = this->m[7] = T(0);
 this->m[8] = this->m[9] = this->m[11] = T(0);
 this->m[12] = this->m[13] = this->m[14] = T(0);

 this->m[0] = this->m[5] = this->m[10] = this->m[15] = T(1);
}

template<class T>
inline void var4x4<T>::transpose(void)
{
 float temp[16];
 memcpy(temp, this->m, sizeof(float) * 16);

 this->m[4] = this->m[1]; this->m[1] = temp[4]; 
 this->m[8] = this->m[2]; this->m[2] = temp[8]; 
 this->m[12] = this->m[3]; this->m[3] = temp[12];
 this->m[9] = this->m[6]; this->m[6] = temp[9]; 
 this->m[13] = this->m[7]; this->m[7] = temp[13]; 
 this->m[14] = this->m[11]; this->m[11] = temp[14];
}
